/**
 * *******************************************
 * user: zmq
 * describe: area生命周期模块
 * created:
 * date: 2021/8/28
 * *******************************************
 */

import {Application, ILifeCycle} from "pinus";
import areaService from "../../service/areaService";


export default function (app: Application) {
    return new AreaLifecycle(app);
}

export class AreaLifecycle implements ILifeCycle{

    /**
     * 构造函数
     * @param {Application} app
     */
    constructor(private app: Application) {
    }

    /**
     * 服务器启动的时候处理数据
     * @param app
     * @param cb
     */
    public async afterStartup (app : Application, cb:() => void) {

        cb();
    };


    /**
     * 所有服务器都启动后要处理的事情
     * @param app
     */
    public  async afterStartAll (app : Application) {
        
        await areaService.startup();
    };
}